//
//  Person.m
//  AddressBook
//
//  Created by 小爪乎黑 on 14/11/29.
//  Copyright (c) 2014年 李帅. All rights reserved.
//

#import "Person.h"
#import "NSString+Characters.h"

@implementation Person


-(NSString *)description{

    return [NSString stringWithFormat:@"name:%@ sex:%@ tel:%@ age:%lu",self.name,self.sex,self.phoneNum,(unsigned long)self.age];
}


-(void)dealloc
{
    [_name release];
    [_phoneNum release];
    [_sex release];

    [super dealloc];
}

-(instancetype)initWithName:(NSString *)aName sex:(NSString*)aSex phoneNum:(NSString *)aPhoneNum age:(NSUInteger)aAge
{

    if (self = [super init]) {
        
        self.name = aName;
        self.sex = aSex;
        self.phoneNum = aPhoneNum;
        self.age = aAge;
    }

    return self;
}

+(Person *)personWithName:(NSString *)aName sex:(NSString*)aSex phoneNum:(NSString *)aPhoneNum age:(NSUInteger)aAge
{

    Person * p = [[Person alloc] initWithName:aName sex:aSex phoneNum:aPhoneNum age:aAge];
    
    return [p autorelease];

}


@end
